package com.ljh.common.config;

import com.ljh.common.utils.MailUtil;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.javamail.JavaMailSender;

/**
 * @author: Themberfue
 * @date: 2025/4/25 18:54
 * @description:
 */
@Configuration
@ConditionalOnClass(JavaMailSender.class)
public class MailUtilConfig {
    @Bean
    @ConditionalOnProperty(prefix = "spring.mail", name = "host")
    MailUtil mailUtil(JavaMailSender javaMailSender) {
        return new MailUtil(javaMailSender);
    }
}
